# 导包
from selenium import webdriver
from selenium.webdriver.common.by import By
# 1.导入鼠标操作类
from selenium.webdriver.common.action_chains import ActionChains
from time import sleep
# 获取浏览器驱动
driver = webdriver.Firefox()
driver.maximize_window()
# 打开测试页面
url = 'file:///C:/Users/tedu/Desktop/NSD2406/html/registerA.html'
driver.get(url)
# 2.实例化鼠标操作对象
action = ActionChains(driver)

# 输入用户名
username = driver.find_element(By.CSS_SELECTOR, '#userA')
username.send_keys('admin')
sleep(3)
# 3.在用户名执行右击
# perform() 执行以上的操作
action.context_click(username).perform()

sleep(3)
# 输入手机号码，然后执行双击
tel = driver.find_element(By.CSS_SELECTOR, '#telA')
tel.send_keys('13899998888')
# 双击
action.double_click(tel).perform()

# 关闭浏览器驱动
sleep(3)
driver.quit()